//microcommand define qrcode
signature("<text:text>", { strictOptions: true, checkArgCount: true })
option("errorCorrection", "-e <[LMQH]>")
option("margin", "-m <margin:natural>")
option("scale", "-s <scale:posint>")
option("width", "-w <width:posint>")
option("dark", "-d <#RRGGBBAA>")
option("light", "-l <#RRGGBBAA>")
action(async ({ options, session }, text) => {
  const { light, dark, errorCorrection, ...opt } = options
  const dataURL = await require("qrcode").toDataURL(text, { ...opt, errorCorrectionLevel: errorCorrection, color: { dark, light } })
  return h.image(dataURL)
})
locale("zh-CN", { description: "生成二维码", options: { errorCorrection: "容错等级（默认M）", margin: "边界尺寸", scale: "缩放比例", width: "图片大小", dark: "暗部颜色", light: "亮部颜色" } })